package com.departmentstore.repository;

import com.departmentstore.entity.DepartmentProduct;
import com.departmentstore.entity.DepartmentProductId;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DepartmentProductRepository extends JpaRepository<DepartmentProduct, DepartmentProductId> {
    // 根据部门ID查找关联
    List<DepartmentProduct> findByDepartment(String departmentId);
    
    // 根据产品ID查找关联
    List<DepartmentProduct> findByProduct(String productId);
    
    // 根据部门ID和产品ID查找关联
    DepartmentProduct findByDepartmentAndProduct(String departmentId, String productId);
} 